package com.example.flo;

import android.accessibilityservice.AccessibilityService;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityEvent;

public class MyAccessibilityService extends AccessibilityService {

    private static MyAccessibilityService instance;

    @Override
    protected void onServiceConnected() {
        super.onServiceConnected();
        instance = this;
    }

    public static MyAccessibilityService getInstance() {
        return instance;
    }

    // 这里不需要重写 onAccessibilityEvent 方法，除非你需要监听其他事件


    @Override
    public void onAccessibilityEvent(AccessibilityEvent accessibilityEvent) {

    }

    @Override
    public void onInterrupt() {}

    public void performBackPress() {
        if (instance != null) {
            performGlobalAction(AccessibilityService.GLOBAL_ACTION_BACK);
        }
    }
}
